<template>
    <div>
        <el-form :model="OfficialSealAdmin" label-width="120px" :rules="rules" ref="UpdataOfficialSealAdmin_refs"
                 :disabled="IsSee">
            <el-row :gutter="24">
                <el-col :span="8">
                    <el-form-item label="名称" prop="Name">
                        <el-input v-model="OfficialSealAdmin.Name"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="保管人" prop="CustodianId">
                        <el-select placeholder="请选择" v-model="OfficialSealAdmin.CustodianId" filterable>
                            <el-option v-for="v in $store.state.AllUsers" v-if="v.InternshipState!=8"
                                       :label="v.UserName" :value="v.Id"></el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col align="center">
                    <el-button type="primary" @click="UpdateSubmit_enent">确认修改</el-button>
                </el-col>
            </el-row>
        </el-form>

    </div>
</template>

<script>
    import * as publicjs from "../../../../public/Scriput/Public";

    export default {
        name: "UpdateOfficialSealAdmin",
        props: {
            IsSee: {
                type: Boolean,
                required: true,
            },
            OfficialSealAdmin: {
                type: Object,
                required: true,
            },
        },
        data() {
            return {
                rules: {
                    Name: [{required: true, message: '请输入名称', trigger: 'change'},],
                    CustodianId: [{required: true, message: '请选择保管人', trigger: 'change'},],
                }
            }
        },
        watch: {

        },
        created() {

        },
        methods: {
            //窗体关闭表格处理
            dialog_close() {
                // 重置表单数据
                this.$refs['UpdataOfficialSealAdmin_refs'].resetFields()
            },
            //确认修改
            UpdateSubmit_enent() {
                this.$refs['UpdataOfficialSealAdmin_refs'].validate(vali => {
                    if (vali) {
                        let loadding = this.openLoading();
                        this.$http.post('OfficialSeal/UpdataOfficialSeal', {officialseal:this.OfficialSealAdmin}).then(res => {
                            loadding.close();
                            if (res.data.msg.IsSuccess) {
                                this.$message.success(res.data.msg.Msg)
                                this.dialog_close()
                                this.$parent.$parent.formdata()
                                this.$parent.$parent.Update_OfficialSealAdmin.dialog = false
                            } else {
                                this.$message.warning(res.data.msg.Msg)
                            }
                        })
                    }
                })
            },
        },
    }
</script>

<style scoped>
</style>
